<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    {:token()}

<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Types')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            {foreach name="typesList" item="vo"}-->
<!--            <label for="row[types]-{$key}"><input class="type_type" id="row[types]-{$key}" name="row[types]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>-->
<!--            {/foreach}-->
<!--        </div>-->
<!--    </div>-->

<!--    <div class="form-group">-->
<!--        <label for="c-pid" class="control-label col-xs-12 col-sm-2">{:__('Pid')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->

<!--            <select id="c-pid" data-rule="required" class="form-control selectpicker" data-custom="" name="row[pid]">-->
<!--                {foreach name="parentList" item="vo"}-->
<!--                <option data-type="{$vo.type}" value="{$key}" {in name="key" value=""}selected{/in}>{$vo.name}</option>-->
<!--                {/foreach}-->
<!--            </select>-->

<!--        </div>-->
<!--    </div>-->


    <div class="form-group">
        <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Types')}:</label>
        <div class="col-xs-12 col-sm-8">

            <select id="c-type" data-rule="required" class="form-control selectpicker" name="row[types]">
                {foreach name="typesList" item="vo"}
                <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label for="c-pid" class="control-label col-xs-12 col-sm-2">{:__('Pid')}:</label>
        <div class="col-xs-12 col-sm-8">

            <select id="c-pid" data-rule="required" class="form-control selectpicker" name="row[pid]">
                {foreach name="parentList" item="vo"}
                <option data-type="{$vo.type}" value="{$key}" {in name="key" value=""}selected{/in}>{$vo.name}</option>
                {/foreach}
            </select>

        </div>
    </div>

    <div class="form-group">
        <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" class="form-control" size="35" name="row[image]" type="text" value="">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-image"></ul>
        </div>
    </div>

    <div class="form-group">
        <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('pc图片')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-pc-image" class="form-control" size="35" name="row[pc_image]" type="text" value="">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-pc-image" class="btn btn-danger plupload" data-input-id="c-pc-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-pc-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-pc-image" class="btn btn-primary fachoose" data-input-id="c-pc-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-pc-image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label for="c-weigh" class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" class="form-control" name="row[weigh]" type="number"  placeholder="越小越靠前">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])}
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>


</form>
<script src="__CDN__/assets/js/jquery-1.11.0.js"></script>
<script type="text/javascript">

    // $(document).ready(function(){
    //       var a =  $("#row[types]-1").val()
    //     console.log(a)
    // });
    $(".type_type").click(function(){
        var radio=   $('.type_type:checked').val();
        console.log(radio)

        // $.ajax();2344574
        // $.ajax({
        //     url:"{:url('index')}",
        //     type:'GET',
        //     data:{
        //         type:radio
        //     },
        //     success:function(result){
        //         console.log(result);
        //         // $("#div1").html(result);
        //     }
        // });

        Fast.api.ajax({
            url:"{:url('index')}",
            data:{type:radio}
        }, function(data, ret){

            console.log(data);
            //成功的回调
            // alert(ret.msg);
            return false;
        }, function(data, ret){
            //失败的回调
            // alert(ret.msg);
            return false;
        });

    })
</script>
